package ldk.util.layoutmanagers.adapter;

import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by ldkxingzhe@163.com on 2017/8/11.
 */

public class AnchorAdapter extends BaseAdapter<AnchorViewHolder, String>{

    public AnchorAdapter(@Nullable List<String> data) {
        super(data);
    }

    @Override
    public AnchorViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new AnchorViewHolder(parent);
    }

    @Override
    public void onBindViewHolder(AnchorViewHolder holder, int position) {
        Log.v("Anchor", "position is " + position);
        super.onBindViewHolder(holder, position);
        holder.show(position + getItemOfPosition(position));
        holder.tvPosition.setVisibility(position % 2 == 0 ? View.GONE : View.VISIBLE);
        holder.tvPosition.setText(String.valueOf(position));
    }
}
